<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>Nordic Thingy:52 v2.2.0 : Speaker driver</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet_offline.css" rel="stylesheet" type="text/css"/>
<link href="nordic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" width="100%" class="blank">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Nordic Semiconductor" src="nordic_small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Nordic Thingy:52 v2.2.0
   </div>
  </td>
 </tr>
 </tbody>
</table>
<script>
var url=window.location.href.split("/").reverse()[1];
var validLinks= ["nrf5","s130","s132","s212","s332"];
var index;
for (index = 0; index < validLinks.length; ++index) {
   if ( url.indexOf(validLinks[index]) !== -1 ) {
      document.getElementById(validLinks[index]).setAttribute('class', 'doclinks docselected');
   };
};
</script>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__speaker__driver.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Speaker driver<div class="ingroups"><a class="el" href="group__drivers.html">Drivers</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Speaker driver API.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structdrv__speaker__init__t.html">drv_speaker_init_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Speaker driver initialization type.  <a href="structdrv__speaker__init__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga034559423c9f99d5f49aa56ae46f1468"><td class="memItemLeft" align="right" valign="top"><a id="ga034559423c9f99d5f49aa56ae46f1468"></a>
typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__speaker__driver.html#ga034559423c9f99d5f49aa56ae46f1468">drv_speaker_evt_handler_t</a>) (<a class="el" href="group__speaker__driver.html#ga1e6b16dcff8e1b47e6fb9eea605700fd">drv_speaker_evt_t</a> evt)</td></tr>
<tr class="memdesc:ga034559423c9f99d5f49aa56ae46f1468"><td class="mdescLeft">&#160;</td><td class="mdescRight">Speaker driver event handler callback type. <br /></td></tr>
<tr class="separator:ga034559423c9f99d5f49aa56ae46f1468"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga1e6b16dcff8e1b47e6fb9eea605700fd"><td class="memItemLeft" align="right" valign="top"><a id="ga1e6b16dcff8e1b47e6fb9eea605700fd"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__speaker__driver.html#ga1e6b16dcff8e1b47e6fb9eea605700fd">drv_speaker_evt_t</a> <tr class="memdesc:ga1e6b16dcff8e1b47e6fb9eea605700fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Speaker driver event types. <br /></td></tr>
</td></tr>
<tr class="separator:ga1e6b16dcff8e1b47e6fb9eea605700fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga7928d5f7ce1a126948746e4828db8940"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__speaker__driver.html#ga7928d5f7ce1a126948746e4828db8940">drv_speaker_ble_pcm_play</a> (uint8_t *p_sound, uint32_t length)</td></tr>
<tr class="memdesc:ga7928d5f7ce1a126948746e4828db8940"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for playing an 8-bit 8 kHz PCM encoded audio split into packages.  <a href="#ga7928d5f7ce1a126948746e4828db8940">More...</a><br /></td></tr>
<tr class="separator:ga7928d5f7ce1a126948746e4828db8940"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga77da11d3f4301a603105262caf1ac68e"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__speaker__driver.html#ga77da11d3f4301a603105262caf1ac68e">drv_speaker_flash_pcm_play</a> (uint8_t const *const p_sound, uint32_t size)</td></tr>
<tr class="memdesc:ga77da11d3f4301a603105262caf1ac68e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for playing an 8-bit 8 kHz PCM encoded audio sample.  <a href="#ga77da11d3f4301a603105262caf1ac68e">More...</a><br /></td></tr>
<tr class="separator:ga77da11d3f4301a603105262caf1ac68e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacc2e2f95dcfcf0669a8f00cd1ab96664"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__speaker__driver.html#gacc2e2f95dcfcf0669a8f00cd1ab96664">drv_speaker_init</a> (<a class="el" href="structdrv__speaker__init__t.html">drv_speaker_init_t</a> *p_params)</td></tr>
<tr class="memdesc:gacc2e2f95dcfcf0669a8f00cd1ab96664"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for initializing the speaker driver.  <a href="#gacc2e2f95dcfcf0669a8f00cd1ab96664">More...</a><br /></td></tr>
<tr class="separator:gacc2e2f95dcfcf0669a8f00cd1ab96664"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7bdd1af306fefe456f3e83ef0c845305"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__speaker__driver.html#ga7bdd1af306fefe456f3e83ef0c845305">drv_speaker_sample_play</a> (uint8_t sample_id)</td></tr>
<tr class="memdesc:ga7bdd1af306fefe456f3e83ef0c845305"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for playing one of the prestored samples. See <a class="el" href="sounds_8h_source.html">sounds.h</a>.  <a href="#ga7bdd1af306fefe456f3e83ef0c845305">More...</a><br /></td></tr>
<tr class="separator:ga7bdd1af306fefe456f3e83ef0c845305"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad269a1dc44882c7f752710b66e36ae9a"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__speaker__driver.html#gad269a1dc44882c7f752710b66e36ae9a">drv_speaker_tone_start</a> (uint16_t freq_hz, uint32_t duration_ms, uint8_t volume)</td></tr>
<tr class="memdesc:gad269a1dc44882c7f752710b66e36ae9a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for playing a single tone through the speaker.  <a href="#gad269a1dc44882c7f752710b66e36ae9a">More...</a><br /></td></tr>
<tr class="separator:gad269a1dc44882c7f752710b66e36ae9a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Speaker driver API. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga7928d5f7ce1a126948746e4828db8940"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7928d5f7ce1a126948746e4828db8940">&#9670;&nbsp;</a></span>drv_speaker_ble_pcm_play()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t drv_speaker_ble_pcm_play </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>p_sound</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function for playing an 8-bit 8 kHz PCM encoded audio split into packages. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">p_sound</td><td>Sound sample. PCM encoded, 8-bit. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>Length of the package.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">NRF_SUCCESS</td><td>Completed successfully. </td></tr>
    <tr><td class="paramname">Other</td><td>codes from underlying drivers. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga77da11d3f4301a603105262caf1ac68e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga77da11d3f4301a603105262caf1ac68e">&#9670;&nbsp;</a></span>drv_speaker_flash_pcm_play()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t drv_speaker_flash_pcm_play </td>
          <td>(</td>
          <td class="paramtype">uint8_t const *const&#160;</td>
          <td class="paramname"><em>p_sound</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function for playing an 8-bit 8 kHz PCM encoded audio sample. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">p_sound</td><td>Sound sample. PCM encoded, 8-bit. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>Size of the sample.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">NRF_SUCCESS</td><td>Completed successfully. </td></tr>
    <tr><td class="paramname">Other</td><td>codes from underlying drivers. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gacc2e2f95dcfcf0669a8f00cd1ab96664"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacc2e2f95dcfcf0669a8f00cd1ab96664">&#9670;&nbsp;</a></span>drv_speaker_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t drv_speaker_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structdrv__speaker__init__t.html">drv_speaker_init_t</a> *&#160;</td>
          <td class="paramname"><em>p_params</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function for initializing the speaker driver. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">p_params</td><td>Initialization parameters.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">NRF_SUCCESS</td><td>Completed successfully. </td></tr>
    <tr><td class="paramname">NRF_ERROR_NULL</td><td>Null pointer supplied. </td></tr>
    <tr><td class="paramname">Other</td><td>codes from underlying drivers. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga7bdd1af306fefe456f3e83ef0c845305"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7bdd1af306fefe456f3e83ef0c845305">&#9670;&nbsp;</a></span>drv_speaker_sample_play()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t drv_speaker_sample_play </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>sample_id</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function for playing one of the prestored samples. See <a class="el" href="sounds_8h_source.html">sounds.h</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">sample_id</td><td>ID of the sample to play.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">NRF_ERROR_INVALID_PARAM</td><td>Invalid sample requested. </td></tr>
    <tr><td class="paramname">Other</td><td>codes from underlying drivers. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gad269a1dc44882c7f752710b66e36ae9a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad269a1dc44882c7f752710b66e36ae9a">&#9670;&nbsp;</a></span>drv_speaker_tone_start()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t drv_speaker_tone_start </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>freq_hz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>duration_ms</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>volume</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function for playing a single tone through the speaker. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">freq_hz</td><td>Tone frequency (&gt;100 Hz). </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">duration_ms</td><td>Tone length [ms]. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">volume</td><td>Speaker volume (0 to 100). 0 Volume will cause the function to return immediately with NRF_SUCCESS.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">NRF_SUCCESS</td><td>Completed successfully. </td></tr>
    <tr><td class="paramname">NRF_ERROR_NOT_SUPPORTED</td><td>Invalid parameters supplied. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="topicfooter">
<a href="mailto:docfeedback@nordicsemi.no?subject=Documentation%20feedback" id="maillink">Documentation feedback</a> | <a href="https://devzone.nordicsemi.com/questions/" target="_blank">Developer Zone</a> | <a href="http://response.nordicsemi.com/subscribe-to-our-newsletters" target="_blank">Subscribe</a> | Updated <span id="date"/>
<script>
var date = new Date("Thu Feb 7 2019" + " UTC");
document.getElementById("date").innerHTML = date.toJSON().slice(0, 10);
var url=window.location.href.split("?")[0];
var filename=url.substring(url.lastIndexOf('/')+1);
document.getElementById("maillink").href = "mailto:docfeedback@nordicsemi.no?subject=Documentation%20feedback"+decodeURIComponent("%26")+"body=File%20name%3A%20"+encodeURIComponent(filename);
</script>
</div>
</body>
</html>
